# RUN: tf-mlir-translate -graphdef-to-mlir -tf-enable-shape-inference-on-import=false %s -tf-input-arrays=p,x -tf-input-data-types="DT_INT32,DT_RESOURCE(DT_INT32)" -tf-output-arrays=p,x -o - | FileCheck %s -check-prefix=CHECK-NO-SHAPE

# RUN: tf-mlir-translate -graphdef-to-mlir -tf-enable-shape-inference-on-import=false %s -tf-input-arrays=p,x -tf-input-shapes=512,1024: -tf-input-data-types="DT_INT32,DT_RESOURCE(512,1024:DT_INT32)" -tf-output-arrays=p,x -o - | FileCheck %s -check-prefix=CHECK-SHAPE

# Test the handling of the input data types. In particular, if the data type
# for an input graph node is specified via command line options, use it.
# otherwise, use the data type of the node in the graph.

node {
  name: "p"
  op: "Placeholder"
  attr {
    key: "dtype"
    value {
      type: DT_INT32
    }
  }
  attr {
    key: "shape"
    value {
      shape {
        unknown_rank: true
      }
    }
  }
}
node {
  name: "x"
  op: "Placeholder"
  attr {
    key: "dtype"
    value {
      type: DT_RESOURCE
    }
  }
  attr {
    key: "shape"
    value {
      shape {
        unknown_rank: true
      }
    }
  }
}
versions {
  producer: 216
}

# CHECK-NO-SHAPE: func @main(%arg0: tensor<i32>, %arg1: tensor<!tf_type.resource<tensor<i32>>>) -> (tensor<i32>, tensor<!tf_type.resource<tensor<i32>>>)

# CHECK-SHAPE: func @main(%arg0: tensor<512x1024xi32>, %arg1: tensor<!tf_type.resource<tensor<512x1024xi32>>>) -> (tensor<512x1024xi32>, tensor<!tf_type.resource<tensor<512x1024xi32>>>)
